Instructions

Answer the following questions and complete the exercises in RMarkdown. Please embed all of your code and push your final work to your repository. Your final lab report should be organized, clean, and run free from errors. Remember, you must remove the # for the included code chunks to run. Be sure to add your name to the author header above. For any included plots, make sure they are clearly labeled. You are free to use any plot type that you feel best communicates the results of your analysis.

Make sure to use the formatting conventions of RMarkdown to make your report neat and clean!

Load the libraries

library(qtl)
library(qtlcharts)
library(tidyverse)
library(ggmap)

1. We have a satellite collars on a number of different individuals and want to be able to quickly look at all of their recent movements at once. Please load all the data files from us_individual_collar_data and use for loop to create plots for all different individuals of the path they move on longitude and latitude.

us_individual_collar_data<-list.files("data/individual_collar_data",pattern= "collar-data-",full.names = TRUE)
us_individual_collar_data
##  [1] "data/individual_collar_data/collar-data-A1-2016-02-26.txt" 
##  [2] "data/individual_collar_data/collar-data-B2-2016-02-26.txt" 
##  [3] "data/individual_collar_data/collar-data-C3-2016-02-26.txt" 
##  [4] "data/individual_collar_data/collar-data-D4-2016-02-26.txt" 
##  [5] "data/individual_collar_data/collar-data-E5-2016-02-26.txt" 
##  [6] "data/individual_collar_data/collar-data-F6-2016-02-26.txt" 
##  [7] "data/individual_collar_data/collar-data-G7-2016-02-26.txt" 
##  [8] "data/individual_collar_data/collar-data-H8-2016-02-26.txt" 
##  [9] "data/individual_collar_data/collar-data-I9-2016-02-26.txt" 
## [10] "data/individual_collar_data/collar-data-J10-2016-02-26.txt"
# only ggplot
for (i in 1:length(us_individual_collar_data)){
  collar_data<- as.data.frame(read_csv(us_individual_collar_data[i]))
  print(
    ggplot(collar_data, aes(x=long,y=lat))+
      geom_path()+
      geom_point()+
      labs(title = us_individual_collar_data[i], x = "longitude", y = "latitude")
  )
}
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

# how to show them on a map?

# summary table
data_list <- lapply(us_individual_collar_data, read_csv)
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
collar_data_all <- bind_rows(data_list)
collar_data_all %>% 
  summarise(max_lat=max(lat),
            min_lat=min(lat),
            max_long=max(long),
            min_long=min(long))
## # A tibble: 1 x 4
##   max_lat min_lat max_long min_long
##     <dbl>   <dbl>    <dbl>    <dbl>
## 1    31.6    14.9     135.     122.
lat <- c(14.91539, 31.56526)
long <- c(122.0874, 134.9906)
bbox <- make_bbox(long, lat, f = 0.5)
map <- get_map(bbox, maptype = "terrain", source = "stamen")
## Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL.
ggmap(map)

for (i in 1:length(us_individual_collar_data)){
  collar_data <- as.data.frame(read_csv(us_individual_collar_data[i]))
  print(
    ggmap(map)+
      geom_path(data = collar_data, aes(long,lat))+
      geom_point(data = collar_data, aes(long,lat))+
      labs(title = us_individual_collar_data[i], x = "longitude", y = "latitude")
  )
}
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

2. Please load all the data files from us_individual_collar_data and combine all data into one data frame. Create a summary to show what is the maximum and minimum of recorded data points on longitude and latitude.

results <- data.frame(file_name = vector(mode = "character", length = length(us_individual_collar_data)),
                      count = vector(mode = "integer", length = length(us_individual_collar_data)))

for (i in 1:length(us_individual_collar_data)){
  collar_data0 <- read_csv(us_individual_collar_data[i])
  count <- nrow(collar_data0)
  results$file_name[i] <- us_individual_collar_data[i]
  results$count[i] <- count
}
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
results
##                                                     file_name count
## 1   data/individual_collar_data/collar-data-A1-2016-02-26.txt    24
## 2   data/individual_collar_data/collar-data-B2-2016-02-26.txt    24
## 3   data/individual_collar_data/collar-data-C3-2016-02-26.txt    24
## 4   data/individual_collar_data/collar-data-D4-2016-02-26.txt    24
## 5   data/individual_collar_data/collar-data-E5-2016-02-26.txt    24
## 6   data/individual_collar_data/collar-data-F6-2016-02-26.txt    24
## 7   data/individual_collar_data/collar-data-G7-2016-02-26.txt    24
## 8   data/individual_collar_data/collar-data-H8-2016-02-26.txt    24
## 9   data/individual_collar_data/collar-data-I9-2016-02-26.txt    24
## 10 data/individual_collar_data/collar-data-J10-2016-02-26.txt    24

3. Use the range of the latitude and longitude from Q2 to build an appropriate bounding box for your map and load a map from stamen in a terrain style projection and display the map. Then, build a final map that overlays the recorded path from Q1.

# summary table
data_list <- lapply(us_individual_collar_data, read_csv)
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
collar_data_all <- bind_rows(data_list)
collar_data_all %>% 
  summarise(max_lat=max(lat),
            min_lat=min(lat),
            max_long=max(long),
            min_long=min(long))
## # A tibble: 1 x 4
##   max_lat min_lat max_long min_long
##     <dbl>   <dbl>    <dbl>    <dbl>
## 1    31.6    14.9     135.     122.
data_list <- lapply(us_individual_collar_data, read_csv)
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
collar_data_all <- bind_rows(data_list)
collar_data_all %>% 
  summarise(max_lat=max(lat),
            min_lat=min(lat),
            max_long=max(long),
            min_long=min(long))
## # A tibble: 1 x 4
##   max_lat min_lat max_long min_long
##     <dbl>   <dbl>    <dbl>    <dbl>
## 1    31.6    14.9     135.     122.
lat <- c(14.91539, 31.56526)
long <- c(122.0874, 134.9906)
bbox <- make_bbox(long, lat, f = 0.5)
map <- get_map(bbox, maptype = "terrain", source = "stamen")
## Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL.
ggmap(map)

data_list <- lapply(us_individual_collar_data, read_csv)
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
collar_data_all <- bind_rows(data_list)
collar_data_all %>% 
  summarise(max_lat=max(lat),
            min_lat=min(lat),
            max_long=max(long),
            min_long=min(long))
## # A tibble: 1 x 4
##   max_lat min_lat max_long min_long
##     <dbl>   <dbl>    <dbl>    <dbl>
## 1    31.6    14.9     135.     122.
lat <- c(14.91539, 31.56526)
long <- c(122.0874, 134.9906)
bbox <- make_bbox(long, lat, f = 0.5)
map <- get_map(bbox, maptype = "terrain", source = "stamen")
## Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL.
ggmap(map)

for (i in 1:length(us_individual_collar_data)){
  collar_data <- as.data.frame(read_csv(us_individual_collar_data[i]))
  print(
    ggmap(map)+
      geom_path(data = collar_data, aes(long,lat))+
      geom_point(data = collar_data, aes(long,lat))+
      labs(title = us_individual_collar_data[i], x = "longitude", y = "latitude")
  )}
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )
## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

## Warning: Missing column names filled in: 'X1' [1]
## 
## -- Column specification --------------------------------------------------------
## cols(
##   X1 = col_double(),
##   date = col_date(format = ""),
##   collar = col_character(),
##   time = col_datetime(format = ""),
##   lat = col_double(),
##   long = col_double()
## )

Load the Data

We will use the data from an experiment on hypertension in the mouse Sugiyama et al., Genomics 71:70-77, 2001

#?hyper
data(hyper)

4. Create a summary of the hypertension data. How many individuals and phenotypes are included in this data set? How many gene markers and chromosomes are included in this data set? Please create a table to show the number of markers on each chromosome.

summary(hyper)
##     Backcross
## 
##     No. individuals:    250 
## 
##     No. phenotypes:     2 
##     Percent phenotyped: 100 100 
## 
##     No. chromosomes:    20 
##         Autosomes:      1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 
##         X chr:          X 
## 
##     Total markers:      174 
##     No. markers:        22 8 6 20 14 11 7 6 5 5 14 5 5 5 11 6 12 4 4 4 
##     Percent genotyped:  47.7 
##     Genotypes (%):    
##           Autosomes:    BB:50.1  BA:49.9 
##        X chromosome:    BY:53.0  AY:47.0

#there are 250 individuals and 2 phenotypes in this data. there are 174 genetic markers and 19 plus 1 x chromosome

5. Please make an interactive genetic map of markers for the hypertension data.

plot(hyper)

plotMap(hyper,show.marker.names = FALSE)

iplotMap(hyper)
## Set screen size to height=700 x width=1000

6. Make a plot shows the pattern of missing genotype data in the hypertension dataset. Please reorder the recorded individuals according to their blood pressure phenotypes. Is there a specific pattern of missing genotype? Please explain it.

plotMissing(hyper, main="")

plotMissing(hyper, main="", reorder=1)

theres a big chunk of data missing from individuals 50 to 200, from this its hard to tell if theres a pattern

plotPheno(hyper, pheno.col=1)

plotPheno(hyper, pheno.col=2)

#plotPheno(hyper, pheno.col=3)
#plotPheno(hyper, pheno.col=4)

7. Based on your answer from previous question, you probably noticed that there are gene markers without data. Please use the function drop.nullmarkers to remove markers that have no genotype data. After this, make a new summary to show the number of markers on each chromosome. How many gene markers were dropped? Where were the dropped markers located? Please use the data without nullmarkers for the following questions.

hyper_no_null<-drop.nullmarkers(hyper)
summary(hyper_no_null)
##     Backcross
## 
##     No. individuals:    250 
## 
##     No. phenotypes:     2 
##     Percent phenotyped: 100 100 
## 
##     No. chromosomes:    20 
##         Autosomes:      1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 
##         X chr:          X 
## 
##     Total markers:      173 
##     No. markers:        22 8 6 20 14 11 7 6 5 5 14 5 5 4 11 6 12 4 4 4 
##     Percent genotyped:  48 
##     Genotypes (%):    
##           Autosomes:    BB:50.1  BA:49.9 
##        X chromosome:    BY:53.0  AY:47.0

it looks like we dropped just one marker, the previous one had 174 prior to running drop null

nmar(hyper)
##  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19  X 
## 22  8  6 20 14 11  7  6  5  5 14  5  5  5 11  6 12  4  4  4
nmar(hyper_no_null)
##  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19  X 
## 22  8  6 20 14 11  7  6  5  5 14  5  5  4 11  6 12  4  4  4

#it looks like we dropped a marker on chromosome 14

8. Please conduct single-QTL analysis and create a table to give the maximum LOD score on each chromosome based on their blood pressure phenotypes. Which gene marker has the higiest LOD score? Which chromosome contains the gene marker that has the highest LOD score? Then, creates an interactive chart with LOD curves from a genome scan for all chromosomes.

hyper_no_null<-calc.genoprob(hyper_no_null,step = 1)
out.em<-scanone(hyper_no_null)
out.em2<-scanone(hyper_no_null,pheno.col = 1)
summary(out.em)
##           chr  pos   lod
## c1.loc45    1 48.3 3.529
## c2.loc45    2 52.7 1.612
## c3.loc33    3 35.2 0.784
## D4Mit164    4 29.5 8.094
## c5.loc68    5 68.0 1.554
## c6.loc23    6 23.0 1.862
## D7Mit297    7 26.2 0.400
## D8Mit271    8 59.0 0.791
## D9Mit18     9 68.9 0.750
## c10.loc8   10 10.2 0.261
## c11.loc36  11 38.2 0.668
## D12Mit37   12  1.1 0.429
## D13Mit78   13 59.0 0.313
## D14Mit7    14 52.5 0.106
## c15.loc14  15 19.5 1.730
## D16Mit70   16 51.4 0.370
## D17Mit46   17  3.3 0.207
## D18Mit17   18 14.2 0.506
## D19Mit59   19  0.0 0.792
## cX.loc38    X 39.1 0.998
summary(out.em2)
##           chr  pos   lod
## c1.loc45    1 48.3 3.529
## c2.loc45    2 52.7 1.612
## c3.loc33    3 35.2 0.784
## D4Mit164    4 29.5 8.094
## c5.loc68    5 68.0 1.554
## c6.loc23    6 23.0 1.862
## D7Mit297    7 26.2 0.400
## D8Mit271    8 59.0 0.791
## D9Mit18     9 68.9 0.750
## c10.loc8   10 10.2 0.261
## c11.loc36  11 38.2 0.668
## D12Mit37   12  1.1 0.429
## D13Mit78   13 59.0 0.313
## D14Mit7    14 52.5 0.106
## c15.loc14  15 19.5 1.730
## D16Mit70   16 51.4 0.370
## D17Mit46   17  3.3 0.207
## D18Mit17   18 14.2 0.506
## D19Mit59   19  0.0 0.792
## cX.loc38    X 39.1 0.998
plot(out.em)

plot(out.em,chr=c(1,4),ylab="LOD score")

#it looks like chromosome 4 has the highest LOD score

iplotScanone(out.em)
iplotScanone(out.em,chr=c(1,4))

9. Based on your genome scan results, create a table which only includes those chromosomes with LOD > 1. Creates an interactive chart with LOD curves linked to estimated QTL effects for only those chromosomes with LOD > 1. Find the gene maker with the highest LOD score and describe how does the genetype of this marker influence the individual’s phenotype.

filtered_out.em<-out.em%>%
  filter(lod>1)

filtered_out.em
##           chr   pos      lod
## c1.loc23    1  26.3 1.083972
## c1.loc24    1  27.3 1.193255
## c1.loc25    1  28.3 1.298508
## c1.loc26    1  29.3 1.398416
## c1.loc27    1  30.3 1.491992
## c1.loc28    1  31.3 1.578553
## c1.loc29    1  32.3 1.657673
## D1Mit156    1  32.8 1.694372
## c1.loc30    1  33.3 1.707122
## c1.loc31    1  34.3 1.691829
## D1Mit178    1  35.0 1.651994
## c1.loc32    1  35.3 1.843815
## c1.loc33    1  36.3 2.459929
## D1Mit19     1  37.2 2.944148
## c1.loc34    1  37.3 2.950735
## c1.loc35    1  38.3 3.010586
## c1.loc36    1  39.3 3.059853
## c1.loc37    1  40.3 3.098968
## c1.loc38    1  41.3 3.128205
## D1Mit7      1  41.5 3.132878
## c1.loc39    1  42.3 3.231014
## c1.loc40    1  43.3 3.317505
## D1Mit46     1  43.7 3.342187
## D1Mit132    1  43.7 3.342187
## c1.loc41    1  44.3 3.387052
## c1.loc42    1  45.3 3.447292
## c1.loc43    1  46.3 3.490557
## c1.loc44    1  47.3 3.517783
## c1.loc45    1  48.3 3.529452
## D1Mit334    1  49.2 3.526704
## c1.loc46    1  49.3 3.510983
## c1.loc47    1  50.3 3.329680
## c1.loc48    1  51.3 3.102652
## c1.loc49    1  52.3 2.826315
## c1.loc50    1  53.3 2.498271
## c1.loc51    1  54.3 2.124402
## D1Mit305    1  54.6 2.006569
## c1.loc52    1  55.3 2.059839
## c1.loc53    1  56.3 2.124785
## c1.loc54    1  57.3 2.176021
## c1.loc55    1  58.3 2.213446
## c1.loc56    1  59.3 2.237311
## c1.loc57    1  60.3 2.248043
## c1.loc58    1  61.3 2.246155
## c1.loc59    1  62.3 2.232212
## c1.loc60    1  63.3 2.206845
## c1.loc61    1  64.3 2.170783
## D1Mit26     1  64.5 2.162361
## c1.loc62    1  65.3 2.584748
## c1.loc63    1  66.3 2.978416
## c1.loc64    1  67.3 3.257581
## D1Mit94     1  67.8 3.362918
## c1.loc65    1  68.3 3.342944
## c1.loc66    1  69.3 3.220749
## D1Mit218    1  69.9 3.096373
## c1.loc67    1  70.3 3.172136
## c1.loc68    1  71.3 3.299773
## c1.loc69    1  72.3 3.338664
## c1.loc70    1  73.3 3.294229
## c1.loc71    1  74.3 3.175861
## D1Mit100    1  74.3 3.175861
## c1.loc72    1  75.3 3.216347
## D1Mit102    1  75.4 3.219835
## c1.loc73    1  76.3 3.363839
## c1.loc74    1  77.3 3.455821
## c1.loc75    1  78.3 3.476983
## c1.loc76    1  79.3 3.431500
## c1.loc77    1  80.3 3.325261
## c1.loc78    1  81.3 3.166189
## D1Mit14     1  82.0 3.029099
## D1Mit105    1  82.0 3.029099
## D1Mit159    1  82.0 3.029217
## D1Mit267    1  82.0 3.029217
## c1.loc79    1  82.3 2.957400
## c1.loc80    1  83.3 2.675915
## c1.loc81    1  84.3 2.331015
## c1.loc82    1  85.3 1.933110
## c1.loc83    1  86.3 1.512487
## D1Mit15     1  86.3 1.512487
## c1.loc84    1  87.3 1.499329
## c1.loc85    1  88.3 1.482691
## c1.loc86    1  89.3 1.462261
## c1.loc87    1  90.3 1.437674
## c1.loc88    1  91.3 1.408508
## c1.loc89    1  92.3 1.374287
## c1.loc90    1  93.3 1.334515
## D1Mit456    1  94.0 1.303128
## c1.loc91    1  94.3 1.294538
## c1.loc92    1  95.3 1.263618
## c1.loc93    1  96.3 1.229213
## c1.loc94    1  97.3 1.191407
## c1.loc95    1  98.3 1.150334
## c1.loc96    1  99.3 1.106176
## c1.loc97    1 100.3 1.059167
## c1.loc98    1 101.3 1.009590
## c2.loc26    2  33.7 1.050028
## c2.loc27    2  34.7 1.099035
## c2.loc28    2  35.7 1.144931
## c2.loc29    2  36.7 1.186969
## c2.loc30    2  37.7 1.224480
## c2.loc31    2  38.7 1.256902
## c2.loc32    2  39.7 1.283781
## c2.loc33    2  40.7 1.304779
## c2.loc34    2  41.7 1.319679
## c2.loc35    2  42.7 1.328380
## c2.loc36    2  43.7 1.330908
## c2.loc37    2  44.7 1.327412
## c2.loc38    2  45.7 1.318175
## c2.loc39    2  46.7 1.303611
## c2.loc40    2  47.7 1.284259
## c2.loc41    2  48.7 1.260772
## D2Mit14     2  49.2 1.247706
## c2.loc42    2  49.7 1.339822
## c2.loc43    2  50.7 1.497585
## c2.loc44    2  51.7 1.594565
## c2.loc45    2  52.7 1.612404
## c2.loc46    2  53.7 1.551728
## D2Mit62     2  54.6 1.445167
## c2.loc47    2  54.7 1.448669
## c2.loc48    2  55.7 1.479618
## c2.loc49    2  56.7 1.502134
## c2.loc50    2  57.7 1.514944
## c2.loc51    2  58.7 1.517074
## c2.loc52    2  59.7 1.507893
## c2.loc53    2  60.7 1.487131
## c2.loc54    2  61.7 1.454910
## c2.loc55    2  62.7 1.411760
## c2.loc56    2  63.7 1.358640
## c2.loc57    2  64.7 1.296937
## c2.loc58    2  65.7 1.228419
## c2.loc59    2  66.7 1.155125
## D2Mit280    2  66.7 1.155125
## c2.loc60    2  67.7 1.050643
## D4Mit149    4   0.0 2.061924
## c4.loc1     4   1.0 2.317346
## c4.loc2     4   2.0 2.582583
## c4.loc3     4   3.0 2.853421
## c4.loc4     4   4.0 3.125668
## c4.loc5     4   5.0 3.395519
## c4.loc6     4   6.0 3.659757
## c4.loc7     4   7.0 3.915797
## c4.loc8     4   8.0 4.161615
## c4.loc9     4   9.0 4.395645
## c4.loc10    4  10.0 4.616646
## c4.loc11    4  11.0 4.823589
## c4.loc12    4  12.0 5.015542
## c4.loc13    4  13.0 5.191582
## c4.loc14    4  14.0 5.350702
## D4Mit41     4  14.2 5.380397
## c4.loc15    4  15.0 5.523762
## c4.loc16    4  16.0 5.531748
## D4Mit108    4  16.4 5.485436
## c4.loc17    4  17.0 6.563385
## D4Mit237    4  17.5 6.557876
## c4.loc18    4  18.0 6.536449
## D4Mit286    4  18.6 6.509250
## c4.loc19    4  19.0 6.572621
## c4.loc20    4  20.0 6.701573
## c4.loc21    4  21.0 6.794140
## D4Mit214    4  21.9 6.849671
## c4.loc22    4  22.0 6.794676
## c4.loc23    4  23.0 5.842222
## D4Mit53     4  23.0 5.842222
## D4Mit89     4  23.0 5.842222
## c4.loc24    4  24.0 6.218547
## c4.loc25    4  25.0 6.316692
## D4Mit111    4  25.1 6.307900
## c4.loc26    4  26.0 6.290307
## c4.loc27    4  27.0 6.254650
## c4.loc28    4  28.0 6.203261
## D4Mit288    4  28.4 6.178436
## c4.loc29    4  29.0 7.472751
## D4Mit164    4  29.5 8.093661
## c4.loc30    4  30.0 7.640598
## D4Mit178    4  30.6 6.374922
## c4.loc31    4  31.0 6.348310
## D4Mit80     4  31.7 5.137589
## D4Mit81     4  31.7 5.137589
## c4.loc32    4  32.0 5.119870
## D4Mit276    4  32.8 4.887561
## c4.loc33    4  33.0 4.866401
## D4Mit152    4  33.9 4.764850
## c4.loc34    4  34.0 4.694565
## c4.loc35    4  35.0 3.728673
## D4Mit302    4  35.0 3.728673
## c4.loc36    4  36.0 3.675329
## c4.loc37    4  37.0 3.616906
## c4.loc38    4  38.0 3.553286
## c4.loc39    4  39.0 3.484368
## c4.loc40    4  40.0 3.410069
## c4.loc41    4  41.0 3.330329
## c4.loc42    4  42.0 3.245116
## c4.loc43    4  43.0 3.154439
## c4.loc44    4  44.0 3.058357
## c4.loc45    4  45.0 2.957005
## c4.loc46    4  46.0 2.850617
## c4.loc47    4  47.0 2.739565
## D4Mit175    4  47.0 2.739565
## c4.loc48    4  48.0 2.848913
## c4.loc49    4  49.0 2.933073
## c4.loc50    4  50.0 2.986540
## c4.loc51    4  51.0 3.005353
## c4.loc52    4  52.0 2.987290
## c4.loc53    4  53.0 2.931932
## c4.loc54    4  54.0 2.840757
## c4.loc55    4  55.0 2.717286
## c4.loc56    4  56.0 2.567186
## D4Mit16     4  56.8 2.433001
## c4.loc57    4  57.0 2.444104
## c4.loc58    4  58.0 2.496393
## c4.loc59    4  59.0 2.542522
## c4.loc60    4  60.0 2.581516
## c4.loc61    4  61.0 2.612546
## c4.loc62    4  62.0 2.634943
## c4.loc63    4  63.0 2.648206
## c4.loc64    4  64.0 2.651993
## c4.loc65    4  65.0 2.646116
## c4.loc66    4  66.0 2.630532
## c4.loc67    4  67.0 2.605338
## c4.loc68    4  68.0 2.570769
## c4.loc69    4  69.0 2.527198
## c4.loc70    4  70.0 2.475147
## c4.loc71    4  71.0 2.415286
## c4.loc72    4  72.0 2.348436
## c4.loc73    4  73.0 2.275560
## c4.loc74    4  74.0 2.197745
## D4Mit14     4  74.3 2.173612
## c5.loc64    5  64.0 1.121662
## c5.loc65    5  65.0 1.294591
## c5.loc66    5  66.0 1.448780
## D5Mit31     5  66.7 1.544770
## c5.loc67    5  67.0 1.548922
## c5.loc68    5  68.0 1.554072
## c5.loc69    5  69.0 1.546512
## c5.loc70    5  70.0 1.527286
## c5.loc71    5  71.0 1.497529
## c5.loc72    5  72.0 1.458415
## c5.loc73    5  73.0 1.411165
## D5Mit99     5  73.2 1.400852
## c5.loc74    5  74.0 1.383307
## D5Mit101    5  74.3 1.352388
## c5.loc75    5  75.0 1.366438
## c5.loc76    5  76.0 1.362578
## c5.loc77    5  77.0 1.329560
## D5Mit409    5  77.6 1.296112
## c5.loc78    5  78.0 1.319219
## c5.loc79    5  79.0 1.359789
## c5.loc80    5  80.0 1.375573
## c5.loc81    5  81.0 1.367060
## c5.loc82    5  82.0 1.335299
## D5Mit169    5  82.0 1.335299
## c6.loc12    6  12.0 1.048968
## c6.loc13    6  13.0 1.146871
## c6.loc14    6  14.0 1.242921
## c6.loc15    6  15.0 1.335679
## c6.loc16    6  16.0 1.423980
## c6.loc17    6  17.0 1.506937
## c6.loc18    6  18.0 1.583916
## c6.loc19    6  19.0 1.654493
## c6.loc20    6  20.0 1.718414
## c6.loc21    6  21.0 1.775555
## D6Mit188    6  21.9 1.821166
## c6.loc22    6  22.0 1.827804
## c6.loc23    6  23.0 1.862040
## c6.loc24    6  24.0 1.850521
## c6.loc25    6  25.0 1.805372
## D6Mit8      6  25.1 1.799307
## c6.loc26    6  26.0 1.672506
## c6.loc27    6  27.0 1.498274
## c6.loc28    6  28.0 1.291016
## c6.loc29    6  29.0 1.060038
## c6.loc31    6  31.0 1.020105
## c6.loc32    6  32.0 1.066863
## c6.loc33    6  33.0 1.107428
## c6.loc34    6  34.0 1.140485
## c6.loc35    6  35.0 1.164955
## c6.loc36    6  36.0 1.180051
## c6.loc37    6  37.0 1.185327
## c6.loc38    6  38.0 1.180714
## c6.loc39    6  39.0 1.166563
## c6.loc40    6  40.0 1.143656
## D6Mit36     6  40.4 1.132296
## c6.loc41    6  41.0 1.142600
## c6.loc42    6  42.0 1.154658
## c6.loc43    6  43.0 1.159450
## c6.loc44    6  44.0 1.156153
## c6.loc45    6  45.0 1.144223
## c6.loc46    6  46.0 1.123453
## c6.loc47    6  47.0 1.094018
## c6.loc48    6  48.0 1.056490
## c6.loc49    6  49.0 1.011819
## c6.loc60    6  60.0 1.049059
## c6.loc61    6  61.0 1.066772
## c6.loc62    6  62.0 1.051934
## c6.loc63    6  63.0 1.008223
## D15Mit11   15   5.5 1.067514
## D15Mit175  15   5.5 1.067514
## c15.loc5   15  10.5 1.036974
## c15.loc6   15  11.5 1.137072
## c15.loc7   15  12.5 1.232173
## D15Mit111  15  13.1 1.286305
## c15.loc8   15  13.5 1.305523
## c15.loc9   15  14.5 1.342501
## c15.loc10  15  15.5 1.363015
## D15Mit56   15  16.4 1.367291
## D15Mit22   15  16.4 1.367291
## c15.loc11  15  16.5 1.419452
## c15.loc12  15  17.5 1.705369
## D15Mit206  15  17.5 1.705369
## D15Mit152  15  17.5 1.705369
## c15.loc13  15  18.5 1.723381
## c15.loc14  15  19.5 1.729778
## c15.loc15  15  20.5 1.722921
## c15.loc16  15  21.5 1.701518
## c15.loc17  15  22.5 1.664717
## c15.loc18  15  23.5 1.612210
## c15.loc19  15  24.5 1.544341
## c15.loc20  15  25.5 1.462256
## c15.loc21  15  26.5 1.368017
## c15.loc22  15  27.5 1.264627
## c15.loc23  15  28.5 1.155848
## c15.loc24  15  29.5 1.045753
## D15Mit156  15  29.5 1.045753
## c15.loc25  15  30.5 1.049079
## c15.loc26  15  31.5 1.051170
## c15.loc27  15  32.5 1.051899
## c15.loc28  15  33.5 1.051140
## c15.loc29  15  34.5 1.048775
## c15.loc30  15  35.5 1.044695
## c15.loc31  15  36.5 1.038801
## c15.loc32  15  37.5 1.031013
## c15.loc33  15  38.5 1.021267
## c15.loc34  15  39.5 1.009518
#this doesnt seem correct
summary(out.em,threshold=1)
##           chr  pos  lod
## c1.loc45    1 48.3 3.53
## c2.loc45    2 52.7 1.61
## D4Mit164    4 29.5 8.09
## c5.loc68    5 68.0 1.55
## c6.loc23    6 23.0 1.86
## c15.loc14  15 19.5 1.73
iplotScanone(out.em,hyper_no_null,chr=c(1,2,4,5,6,15))

10. Please save your interactive chart from Q9 as a html file hyper_iplotScanone.html and make sure your upload it to your github repository with your lab14 homework as well. ## Push your final code to GitHub!

hyper_lod<-iplotScanone(out.em,hyper_no_null,chr=c(1,2,4,5,6,15))
htmlwidgets::saveWidget(hyper_lod,file = "hyper_iplotScanone.html")

Please be sure that you check the keep md file in the knit preferences.